{% extends "layout.html" %}

    {% block content %}
        <div class="container">
            <div style="margin-bottom: 10px">
                <h4>
                     <a class="btn-success" href="/stu/add/">
                        <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
                        添加学生
                    </a>
                </h4>
            </div>

            <div>
                <div class="panel panel-default">
                    <!--面板头-->
                    <div class="panel-heading">
                        <span class="glyphicon glyphicon-th-list" aria-hidden="true"></span>
                        学生列表
                    </div>
                    <form method="post">
                        <input type="text" name="sid" placeholder="请输入学号" style="margin-left: 2px; margin-bottom: 2px; margin-top: 2px" required="">
                        <button type="submit">查询</button>
                    </form>
                    <!--数据区域-->
                    <table class="table table-bordered">
                        <thead>
                          <tr>
                            <th>学号</th>
                            <th>姓名</th>
                            <th>性别</th>
                            <th>年龄</th>
                            <th>住址</th>
                            <th>校园卡余额</th>
                            <th>入学时间</th>
                            <th>所属院系</th>
                            <th>操作</th>
                          </tr>
                        </thead>
                        <tbody>
                            {% for student in students %}
                              <tr>
                                <td>{{ student.id }}</td>
                                <td>{{ student.name }}</td>
                                <td>{{ student.get_gender_display}}</td>
                                <td>{{ student.age }}</td>
                                <td>{{ student.address }}</td>
                                <td>{{ student.account }}</td>
                                <td>{{ student.time|date:"Y-m-d"}}</td>
                                <td>{{ student.depart.title}}</td>
                                <td>
                                    <a class="btn btn-primary btn-xs" href="/stu/update/?sid={{ student.id }}">编辑</a>
                                    <a class="btn btn-danger btn-xs" href="/stu/delete/?sid={{ student.id }}">删除</a>
                                </td>
                              </tr>
                            {% endfor %}
                        </tbody>
                </table>
                </div>
            </div>
        </div>
    {% endblock %}
